#include "TcpServer.hpp"
#include "ServerCal.hpp"

int main(int argc, char* argv[])
{
    if(argc != 2)
    {
        std::cout << "\nUsage: ./ServerCal <port>\n" << std::endl;
        exit(0);
    }

    uint16_t port = std::stoi(argv[1]);
    
    ServerCal cal;
    TcpServer* tcpserver = new TcpServer(port, std::bind(&ServerCal::Calculator, &cal, std::placeholders::_1));
    tcpserver->Init();
    tcpserver->Start();
    daemon(1, 0);   // 不改路径、重定向标准输入输出/dev/null
    return 0;
}